package lanqiaobei2015;

public class _07立方尾不变 {
    /**
     * 有些数的立方的末尾正好是该数字本身(例如1,4,5,6,9,24,25),请你计算一下10000以内,符合这个特征的正整数一共有多少个
     */
    static int ans = 0;
    public static void main(String[] args) {
       for (long i = 1; i <= 10000; i ++){
           long temp = i*i*i;
           check(temp,i);
       }
        System.out.println(ans);
    }

    private static void check(long temp,long i) {
        String after = String.valueOf(temp);
        String before = String.valueOf(i);
        if (after.substring(after.length() - before.length()).equals(before)){
            ans++;
        }
    }
}
